5 休息中の凝集性に影響する要因

以下の分析では、オスからの攻撃のリスクが群れの凝集性に影響するかを検討する。

5.1 データの加工

まず、休息集団内のメス数と、3m以内のメス数、5m以内のメス数(2019は除く)を算出する。また、近接に群れオスがいたかを示した列を作成する。

## 近接メス情報の作成  
adult18 <- unique(female18 %>% filter(age >= 6) %>% .$femaleID)
adult19 <- unique(female19 %>% filter(age >= 6) %>% .$femaleID)
adult20 <- unique(female20 %>% filter(age >= 6) %>% .$femaleID)
adult21 <- unique(female21 %>% filter(age >= 6) %>% .$femaleID)

focal_raw_fin %>% 
  separate(x0_1m, into = str_c("x0_1m",1:11), sep = ",") %>% 
  separate(x1_3m, into = str_c("x1_3m",1:15), sep = ",") %>% 
  separate(x3_5m, into = str_c("x3_5m",1:16), sep = ",") %>% 
  separate(x5_10m, into = str_c("x5_10m", 1:9), sep = ",")  %>% 
  pivot_longer(cols = x0_1m1:x5_10m5,
               names_to = "proximity",
               values_to = "ID") %>% 
  mutate(proximity = ifelse(str_detect(proximity,"x0_1m"),"x0_1m",
                            ifelse(str_detect(proximity,"x1_3m"),"x1_3m",
                                   ifelse(str_detect(proximity,"x3_5m"),"x3_5m",
                                          ifelse(str_detect(proximity,"x5_10m"),"x5_10m","NA"))))) %>% 
  filter(!is.na(ID)) -> focal_prox

## 休息集団
RG_female <- focal_prox %>% 
  filter(RG == "1") %>% 
  filter((study_period == "m18" & ID %in% adult18)|(study_period == "m19" & ID %in% adult19)|
           (study_period == "m20" & ID %in% adult20)|(study_period == "m21" & ID %in% adult21)) %>% 
  group_by(date, no_focal, time) %>% 
  summarise(RGfemale = n()) %>% 
  ungroup()

## 休息集団内の発情メス数
focal_prox %>% 
  filter(RG == "1") %>% 
  filter((study_period == "m18" & ID %in% adult18)|(study_period == "m19" & ID %in% adult19)|
           (study_period == "m20" & ID %in% adult20)|(study_period == "m21" & ID %in% adult21)) %>% 
  select(date, no_focal, time, ID) %>% 
  left_join(female_all %>% select(date, femaleID, rs2), by = c("date","ID" = "femaleID")) %>% 
  filter(rs2 == "1") %>% 
  group_by(date, no_focal, time) %>% 
  summarise(RGest = n()) -> RGest_female 

## 休息集団内に各オスがいるか否か  
RG_TY <- focal_prox %>% 
  filter(RG == "1") %>% 
  select(date, no_focal, time, ID) %>% 
  filter(ID == "TY") %>% 
  mutate(RG_TY = 1) %>% 
  select(-ID)

RG_IT <- focal_prox %>% 
  filter(RG == "1") %>% 
  select(date, no_focal, time, ID) %>% 
  filter(ID == "IT") %>% 
  mutate(RG_IT = 1) %>% 
  select(-ID)

RG_LK <- focal_prox %>% 
  filter(RG == "1") %>% 
  select(date, no_focal, time, ID) %>% 
  filter(ID == "LK") %>% 
  mutate(RG_LK = 1) %>% 
  select(-ID)

RG_KR <- focal_prox %>% 
  filter(RG == "1") %>% 
  select(date, no_focal, time, ID) %>% 
  filter(ID == "KR") %>% 
  mutate(RG_KR = 1) %>% 
  select(-ID)

## 3m、5m近接  
focal_prox %>% 
  mutate(ID = str_replace(ID, "\\(F\\)","")) %>% 
  mutate(ID = str_replace(ID, "\\(M\\)","")) %>% 
  mutate(ID = str_replace(ID, "\\(O\\)","")) %>% 
  mutate(ID = str_replace(ID, "\\(N\\)","")) %>% 
  mutate(ID = str_replace(ID, "\\(n\\)","")) %>% 
  filter((study_period == "m18" & ID %in% adult18)|(study_period == "m19" & ID %in% adult19)|
           (study_period == "m20" & ID %in% adult20)|(study_period == "m21" & ID %in% adult21)) -> focal_prox_all
  
focal_prox_all %>% 
  filter(proximity %in% c("x0_1m","x1_3m")) %>% 
  group_by(date, no_focal, time) %>% 
  summarise(x3m_female = n()) %>% 
  ungroup() -> x3m_female

focal_prox_all %>% 
  filter(proximity %in% c("x0_1m","x1_3m","x3_5m")) %>% 
  group_by(date, no_focal, time) %>% 
  summarise(x5m_female = n()) %>% 
  ungroup() -> x5m_female

## 元データに結合  
focal_raw_fin %>% 
  left_join(RG_female, by = c("date","no_focal","time")) %>% 
  left_join(RGest_female, by = c("date","no_focal","time")) %>% 
  left_join(x3m_female, by = c("date","no_focal","time")) %>% 
  left_join(x5m_female, by = c("date","no_focal","time")) %>% 
  left_join(RG_TY, by = c("date","no_focal","time")) %>% 
  left_join(RG_IT, by = c("date","no_focal","time")) %>% 
  left_join(RG_LK, by = c("date","no_focal","time")) %>% 
  left_join(RG_KR, by = c("date","no_focal","time")) %>% 
  replace_na(list(RGfemale = 0, RGest = 0, x3m_female = 0, x5m_female =0, RG_TY = 0,
                  RG_IT = 0, RG_LK = 0, RG_KR = 0)) %>% 
  replace_na(list(x0_1m = "NA",x1_3m = "NA", x3_5m = "NA", x5_10m = "NA")) %>% 
  mutate(RGfemale_plus1 = RGfemale + 1) %>% 
  ## TYとITの情報を追加  
  mutate(TY_10m = ifelse(str_detect(x0_1m,"TY")|str_detect(x1_3m,"TY")|str_detect(x3_5m,"TY")|str_detect(x5_10m,"TY"),1,0),
         TY_5m = ifelse(str_detect(x0_1m,"TY")|str_detect(x1_3m,"TY")|str_detect(x3_5m,"TY"),1,0),
         TY_3m = ifelse(str_detect(x0_1m,"TY")|str_detect(x1_3m,"TY"),1,0)) %>% 
  mutate(IT_10m = ifelse(str_detect(x0_1m,"IT")|str_detect(x1_3m,"IT")|str_detect(x3_5m,"IT")|str_detect(x5_10m,"IT"),1,0),
         IT_5m = ifelse(str_detect(x0_1m,"IT")|str_detect(x1_3m,"IT")|str_detect(x3_5m,"IT"),1,0),
         IT_3m = ifelse(str_detect(x0_1m,"IT")|str_detect(x1_3m,"IT"),1,0)) %>% 
  mutate(KR_10m = ifelse(str_detect(x0_1m,"KR")|str_detect(x1_3m,"KR")|str_detect(x3_5m,"KR")|str_detect(x5_10m,"KR"),1,0),
         KR_5m = ifelse(str_detect(x0_1m,"KR")|str_detect(x1_3m,"KR")|str_detect(x3_5m,"KR"),1,0),
         KR_3m = ifelse(str_detect(x0_1m,"KR")|str_detect(x1_3m,"KR"),1,0)) %>% 
  mutate(LK_10m = ifelse(str_detect(x0_1m,"LK")|str_detect(x1_3m,"LK")|str_detect(x3_5m,"LK")|str_detect(x5_10m,"LK"),1,0),
         LK_5m = ifelse(str_detect(x0_1m,"LK")|str_detect(x1_3m,"LK")|str_detect(x3_5m,"LK"),1,0),
         LK_3m = ifelse(str_detect(x0_1m,"LK")|str_detect(x1_3m,"LK"),1,0)) %>% 
  left_join(base_all %>% select(date,temp_am,temp_pm)) -> focal_raw_prox

その日群れ内にいた血縁個体数を書く。

kin <- read_csv("data/kin.csv")

focal_raw_fin %>% 
  distinct(study_period, date,no_focal, subject) %>% 
  left_join(female_all %>% select(date, femaleID, presence)) %>% 
  filter(!(subject == femaleID)) %>% 
  left_join(kin, by = c("study_period", "subject","femaleID")) %>% 
  mutate(kin_presence = ifelse(presence == "1" & kin > 0.0625,1,0)) %>% 
  left_join(att, by = c("study_period","femaleID")) %>% 
  filter(age >= 6) %>% 
  group_by(no_focal, date, subject) %>%
  summarise(no_kin = sum(kin_presence)) %>% 
  ungroup() -> focal_numkin

focal_raw_prox %>% 
  left_join(focal_numkin, by = c("no_focal","date","subject")) -> focal_raw_prox_b

その日観察したオトナメスへの攻撃頻度も追加する。各観察日に観察された群れオス/群れ外オスからの攻撃の頻度を算出し、個体追跡データにくっつける。

aggression_all %>% 
  left_join(males, by = c("aggressor" = "maleID","study_period")) %>% 
  drop_na(ntm) %>% 
  group_by(date, ntm) %>% 
  summarise(agg = n()) %>% 
  ungroup() %>% 
  pivot_wider(names_from = ntm,
              values_from = agg) %>% 
  rename("agg_tm" = 2, "agg_ntm" = 3) %>% 
  left_join(base_all %>% select(date, duration)) %>% 
  filter(duration >= 300) %>% 
  replace_na(list(agg_tm = 0, agg_ntm = 0)) %>% 
  mutate(rate_tm = agg_tm*60/duration,
         rate_ntm = agg_ntm*60/duration) -> aggression_daily

aggression_all %>% 
  group_by(date) %>% 
  summarise(agg = n()) %>% 
  ungroup() %>% 
  left_join(base_all %>% select(date, duration)) %>% 
  filter(duration >= 300) %>% 
  replace_na(list(agg = 0)) %>% 
  mutate(rate_agg = agg*60/duration) -> aggression_daily_all
  

focal_raw_prox_b %>% 
  left_join(aggression_daily, by = "date") %>% 
  left_join(aggression_daily_all, by = "date") -> focal_raw_prox_fin

作成したデータは以下の通り。

datatable(focal_raw_prox_fin,
          options = list(scrollX = 80),
          filter = list(position = "top"))

5.2 群れ外オス数やTY、ITの有無と群れ内の凝集性の関連

まず、5分ごとの休息集団サイズをしようして分析を行う。

5.2.1 データの加工

5分ごとの休息集団サイズを抽出する。なお、以下の条件を満たすもののみを抽出した。

  • 6歳以上のメスが50%以上観察できたときのみのデータを使用する。
  • 3位以下のオスまたは群れ外オスとコンソートしていた個体追跡セッションは除外した。
focal_raw_prox_fin %>% 
  mutate(rate_female = no_female/max_female) %>% 
  filter(max_female >= 0.5) %>% 
  filter(consort <= 2) %>% 
  replace_na(list(hud = 0)) %>% 
  filter(hud != "1") %>% 
  filter(RG == "1")  %>% 
  filter(time %% 5 == 0) %>% 
  mutate(cen_ntm = no_ntm - mean(no_ntm, na.rm = TRUE)) %>% 
  mutate(N = 1:n())  %>% 
  mutate(TY2 = ifelse(TY == "1" & TY_10m == "1", "a",
                      ifelse(TY == "1" & TY_10m == "0", "b",
                             ifelse(TY == "0", "c", "NA")))) -> focal_rest
focal_raw_prox_fin %>% 
  filter(activity == "F" & T_G == "G") %>% 
  mutate(rate_female = no_female/max_female) %>% 
  filter(max_female >= 0.5) %>% 
  filter(consort <= 2) %>% 
  replace_na(list(hud = 0)) %>% 
  filter(time %% 5 == 0) %>% 
  filter(rs2 == "0") %>% 
  mutate(cen_ntm = no_ntm - mean(no_ntm, na.rm = TRUE)) %>% 
  mutate(N = 1:n())  %>% 
  mutate(TY2 = ifelse(TY == "1" & TY_10m == "1", "a",
                      ifelse(TY == "1" & TY_10m == "0", "b",
                             ifelse(TY == "0", "c", "NA")))) -> focal_feed

focal_feed %>% 
  ggplot(aes(x = no_ntm, y = x3m_female/no_female-1))+
  geom_count()+
  facet_wrap(study_period~TY)+
  geom_smooth(method = "glm")

5.3 各個体追跡セッションを1つのサンプルとする

各個体追跡セッションにおける平均休息集団サイズと平均周辺個体数を算出する。ただし、少なくとも地上での休息が10分以上ある日のみを抽出する。

focal_raw_prox_fin %>%
  filter(study_period != "m18") %>% 
  filter(RG == "1") %>% 
  filter(RGsuc3 == "1") %>% 
  mutate(TY = as.factor(TY),
         IT = as.factor(IT)) %>% 
  ungroup() %>% 
  group_by(no_focal, subject, date, consort, rs2, TY, IT, no_ntm, no_est, study_period, no_female, rate_agg, rate_ntm, rate_tm, no_kin, temp_am) %>% 
  summarise(N = n(),
            sum = sum(RGfemale+1, na.rm = TRUE),
            max = max(RGfemale+1),
            sum_5m = sum(x5m_female, na.rm = TRUE),
            sum_TY10m = sum(TY_10m),
            sum_TY3m = sum(TY_3m)) %>%
  ungroup() %>% 
  filter(consort <= 2, N >= 15) %>% 
  replace_na(list(IT = "0")) %>% 
  filter(TY != "2" & IT != "2") %>% 
  mutate(cen_ntm = no_ntm- mean(no_ntm, na.rm = TRUE),
         cen_est = no_est - mean(no_est, na.rm = TRUE),
         logN = log(N)) -> RGsize_sum

6 ネットワーク図の作成

6.1 データの加工

focal_prox %>% 
  filter(RG == "1") %>% 
  filter((study_period == "m18" & ID %in% c(adult18,"TY","IT","LK","KR"))|(study_period == "m19" & ID %in% c(adult19,"TY","IT","LK","KR"))|(study_period == "m20" & ID %in% c(adult20,"TY","IT","KR"))|(study_period == "m21" & ID %in% c(adult21,"TY","KR","KM"))) %>% 
  select(date, no_focal, time, subject, ID) %>% 
  filter(time %% 5 == 0) %>% 
  mutate(presence = 1) -> RGmember 
  
RGmember %>% 
  tidyr::expand(nesting(date,no_focal,subject,time), ID) %>% 
  left_join(RGmember, by = c("date","no_focal","subject","time","ID")) %>% 
  mutate(presence = ifelse(subject == ID, 1,presence)) %>% 
  replace_na(list(presence = 0)) %>% 
  mutate(N = str_c(no_focal,"-",time)) %>% 
  pivot_wider(names_from = ID, values_from = presence) %>% 
  left_join(focal_raw_fin %>% select(no_focal,time, subject,rs2,TY,IT) %>% rename(TYpre = TY, ITpre = IT),
            by = c("no_focal","subject","time")) %>% 
  filter(rs2 == "0") -> RG_gbi
## 2018
RG_gbi %>% 
  filter(str_detect(no_focal,"m18")) %>% 
  select(-(1:5), -Coc,-Anz,-Har,-KM,-Ntm,-Trt,-rs2,-Mif,-TYpre,-ITpre) -> gbi_2018

matRG_2018 <- get_network(gbi_2018,
                          data_format = "GBI",
                          association_index = "HWI")
## Generating  21  x  21  matrix
met.eigen(matRG_2018)
##        Aka        Ako        Hen        Hot         IT        Kil        Kit 
## 0.44078775 0.47183370 0.31972946 0.41944298 0.25346097 0.83048114 0.58387368 
##        Koh        Kol         KR        Kun        Kur         LK        Mal 
## 0.75431489 0.64058728 0.02860217 0.61926988 0.87827233 0.38294383 0.72605090 
##        Mei        Mik        Ntr        Tam        Ten        Tot         TY 
## 0.27475990 0.80792080 0.46424166 0.47005754 0.72348355 0.56421162 1.00000000
## 2019
### TY不在 vs TY在  
RG_gbi %>% 
  filter(str_detect(no_focal,"m19")) %>% 
  filter(TYpre == "1" & ITpre == "1") %>% 
  select(-(1:5), -Coc,-Anz,-Har,-KM,-Ntm,-Trt,-rs2,-TYpre, -ITpre, -IT) -> gbi_2019_TY

matRG_2019TY <- get_network(gbi_2019_TY,
                          data_format = "GBI",
                          association_index = "HWI")
## Generating  21  x  21  matrix
met.eigen(matRG_2019TY)
##        Aka        Ako        Hen        Hot        Kil        Kit        Koh 
## 0.39982475 0.24852013 1.00000000 0.30555917 0.88950093 0.47231021 0.93226198 
##        Kol         KR        Kun        Kur         LK        Mal        Mei 
## 0.86725969 0.03244162 0.52290618 0.00000000 0.00000000 0.95549435 0.79098273 
##        Mif        Mik        Ntr        Tam        Ten        Tot         TY 
## 0.74312158 0.88999037 0.38652124 0.11942216 0.38221904 0.15950829 0.54155559
RG_gbi %>% 
  filter(str_detect(no_focal,"m19")) %>% 
  filter(TYpre == "0") %>% 
  select(-(1:5), -Coc,-Anz,-Har,-KM,-Ntm,-Trt,-rs2,-TYpre, -ITpre, -IT, -TY) -> gbi_2019_notTY

matRG_2019notTY <- get_network(gbi_2019_notTY,
                          data_format = "GBI",
                          association_index = "HWI")
## Generating  20  x  20  matrix
met.eigen(matRG_2019notTY)
##       Aka       Ako       Hen       Hot       Kil       Kit       Koh       Kol 
## 0.2401426 0.1963205 0.4653405 0.5375263 0.7338110 0.8895349 0.6565876 1.0000000 
##        KR       Kun       Kur        LK       Mal       Mei       Mif       Mik 
## 0.1165402 0.3961335 0.0000000 0.9905986 0.6208118 0.6184282 0.6010717 0.2857917 
##       Ntr       Tam       Ten       Tot 
## 0.5298359 0.7081603 0.7753288 0.9228832
## 2020
### TY不在 vs TY在  
RG_gbi %>% 
  filter(str_detect(no_focal,"m20")) %>% 
  filter(TYpre == "1") %>% 
  select(-(1:5), -Har,-KM,-rs2,-TYpre, -ITpre, -IT, -LK) -> gbi_2020_TY

matRG_2020TY <- get_network(gbi_2020_TY,
                          data_format = "GBI",
                          association_index = "HWI")
## Generating  24  x  24  matrix
met.eigen(matRG_2020TY)
##        Aka        Ako        Anz        Coc        Hen        Hot        Kil 
## 0.00000000 0.00000000 0.07089038 0.87084799 0.19866119 0.91294260 0.44416003 
##        Kit        Koh        Kol         KR        Kun        Kur        Mal 
## 0.57812081 0.37103268 0.76766668 0.00000000 0.25137436 0.00000000 0.25262425 
##        Mei        Mif        Mik        Ntm        Ntr        Tam        Ten 
## 0.13500953 0.02209585 0.29473435 0.63322605 0.30746584 0.68712767 0.67249626 
##        Tot        Trt         TY 
## 1.00000000 0.15621231 0.36948945
RG_gbi %>% 
  filter(str_detect(no_focal,"m20")) %>% 
  filter(TYpre == "0") %>% 
  select(-(1:5), -Har,-KM,-rs2,-TYpre, -ITpre, -IT, -TY, -LK) -> gbi_2020_notTY

matRG_2020notTY <- get_network(gbi_2020_notTY,
                          data_format = "GBI",
                          association_index = "HWI")
## Generating  23  x  23  matrix
met.eigen(matRG_2020notTY)
##       Aka       Ako       Anz       Coc       Hen       Hot       Kil       Kit 
## 0.4364763 0.2508912 0.4364763 0.7148038 0.8460359 0.2039867 0.6239721 0.5441316 
##       Koh       Kol        KR       Kun       Kur       Mal       Mei       Mif 
## 0.7603631 0.9002807 0.3804224 0.9314443 0.0000000 0.5071959 0.7766237 0.1202806 
##       Mik       Ntm       Ntr       Tam       Ten       Tot       Trt 
## 0.5498779 0.2749963 0.2467659 0.8467572 0.5800646 0.4293328 1.0000000
## 2021年  
RG_gbi %>% 
  filter(str_detect(no_focal,"m21")) %>% 
  filter(TYpre == "1") %>% 
  select(-(1:5), -rs2,-TYpre, -ITpre, -IT,-LK) -> gbi_2021_TY

matRG_2021TY <- get_network(gbi_2021_TY,
                          data_format = "GBI",
                          association_index = "HWI")
## Generating  26  x  26  matrix
met.eigen(matRG_2021TY)
##       Aka       Ako       Anz       Coc       Har       Hen       Hot       Kil 
## 0.8213049 0.9689298 0.9881820 0.5227686 0.5434123 0.5817776 0.1994730 0.7261036 
##       Kit        KM       Koh       Kol        KR       Kun       Kur       Mal 
## 0.7744413 0.4688798 0.8778040 0.7438696 0.9176916 0.7494463 0.0000000 0.1876442 
##       Mei       Mif       Mik       Ntm       Ntr       Tam       Ten       Tot 
## 0.7084668 0.5215743 0.4097817 0.6863208 0.7473281 0.0000000 0.6263100 0.4299243 
##       Trt        TY 
## 0.8360327 1.0000000
RG_gbi %>% 
  filter(str_detect(no_focal,"m21")) %>% 
  filter(TYpre == "0") %>% 
  select(-(1:5), -rs2,-TYpre, -ITpre, -IT, -TY,-LK) -> gbi_2021_notTY

matRG_2021notTY <- get_network(gbi_2021_notTY,
                          data_format = "GBI",
                          association_index = "HWI")
## Generating  25  x  25  matrix
met.eigen(matRG_2021notTY)
##        Aka        Ako        Anz        Coc        Har        Hen        Hot 
## 0.00000000 0.09823517 0.04713812 0.85441085 0.01959088 0.47293350 0.09723847 
##        Kil        Kit         KM        Koh        Kol         KR        Kun 
## 0.55589108 0.52374994 0.00000000 1.00000000 0.93466628 0.65137452 0.82855677 
##        Kur        Mal        Mei        Mif        Mik        Ntm        Ntr 
## 0.00000000 0.33450495 0.05723267 0.15484161 0.00000000 0.56164448 0.38655585 
##        Tam        Ten        Tot        Trt 
## 0.00000000 0.44946138 0.21034578 0.03208237